﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using DDD4Fun.Observer;

namespace DDD4Fun.Ducks
{
    public class QuackCounter:IQuackable
    {
        IQuackable duck;
        static int numOfQuacks;

        public QuackCounter(IQuackable duck)
        {
            this.duck = duck;
            numOfQuacks = 0;
        }

        #region IQuackable Members

        public void Quack()
        {
            duck.Quack();
            numOfQuacks++;
        }

        public static int getQuacks()
        {
            return numOfQuacks;
        }

        #endregion

        #region IObservable Members

        public void Register(Observer.IObserver anObserver)
        {
            duck.Register(anObserver);
        }

        public void UnRegister(Observer.IObserver anObserver)
        {
            duck.UnRegister(anObserver);
        }

        public void NotifyObservers(object anObject)
        {
            duck.NotifyObservers(anObject);
        }

        #endregion
    }
}
